package com.budwk.app.sqfwV2.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum PropagandaScreeningEnum {
    A(1,"宣传记录","sqfwV2/propagandaScreening/1.docx","宣传记录","sqfwV2/propagandaScreening/templet/宣传记录.docx","/preview/xuan/1.png"),
    B(2,"走访排查","sqfwV2/propagandaScreening/2.docx","走访排查","sqfwV2/propagandaScreening/templet/走访排查.docx","/preview/xuan/2.png"),
    C(3,"宣传记录","sqfwV2/propagandaScreening/3.xlsx","宣传表台账","sqfwV2/propagandaScreening/templet/宣传表台账.xlsx","/preview/xuan/3.png"),
    D(4,"走访排查","sqfwV2/propagandaScreening/4.xlsx","走访排查表台账","sqfwV2/propagandaScreening/templet/走访排查表台账.xlsx","/preview/xuan/4.png"),
    ;
    private  int code;
    private  String name;
    private  String templat;
    private  String fileName;
    private  String blankTemplate;
    private  String previewImage;



    public static String getFileName(String name){
        String filename = Arrays.asList(PropagandaScreeningEnum.values())
                .stream()
                .filter(e -> name .equals(e.getName()) )
                .collect(Collectors.toList())
                .get(0)
                .getFileName();
        return filename;
    }

    public static String getBlankTemplate(Integer code){
        String blankTemplate = Arrays.asList(PropagandaScreeningEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getBlankTemplate();
        return blankTemplate;
    }
    public static String getName(Integer code){
        String name = Arrays.asList(PropagandaScreeningEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getName();
        return name;
    }

    public static String getPdfTemplatName(String name){
        String templat = Arrays.asList(PropagandaScreeningEnum.values())
                .stream()
                .filter(e -> name .equals(e.getName()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }

    public static String getPdfTemplat(Integer code){
        String templat = Arrays.asList(PropagandaScreeningEnum.values())
                .stream()
                .filter(e ->  code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getTemplat();
        return templat;
    }
    public static String getFileName(Integer code){
        String fileName = Arrays.asList(PropagandaScreeningEnum.values())
                .stream()
                .filter(e -> code .equals(e.getCode()) )
                .collect(Collectors.toList())
                .get(0)
                .getFileName();
        return fileName;
    }

}
